/*
 * @Author: xmily
 * @Date: 2022-03-03 23:28:56
 * @LastEditors: xmily
 * @LastEditTime: 2022-03-14 00:11:46
 * @FilePath: \glxxapi\models\roleandauth\pcBrowerMenuLink.js
 * @Description: 
 * 
 * Copyright (c) 2022 by xmily/mxthink.com.cn, All Rights Reserved. 
 */
var mongoose = require('../../cfg/dbconfig.js')
var pcBrowerMenuLinkSchema = new mongoose.Schema({
    level:String,
    upLevelPath:String,
    title:String,
    icon:String,
    url:String,
    status:Boolean,
    sq:Number,
    roles:String,
}, { collection: 'browermenulink' })

//根据条件查找记录并返回（全部/指定）字段
//myFindByQuery({"_id":'1231231231232'})
//myFindByQuery({"_id":'1231231231232'},'name gender')  myFindByQuery({"_id":'1231231231232'},'-name -gender')  
pcBrowerMenuLinkSchema.statics.myFindByQuery=async function(query,fields,sort){
    query=query||{};
    fields=fields||{};
    sort=sort||{};
    // if(fields)
    // {
        return await this.find(query,fields).sort(sort).exec()
    // }
    // return await this.find(query).exec()
}

module.exports = mongoose.model('browermenulink', pcBrowerMenuLinkSchema)